// 管理员登录接口
const express = require('express');
const router = express.Router();
const db = require('../../db/connect');
const xzid = require('xzid');
const dayjs = require("dayjs");

router.post('/student/insertRoom', (req, res) => {
    const { roomId,room,floor_id,room_num ,room_dian,student_id,room_water} = req.body;
    // const now = dayjs().format('YYYY-MM-DD HH:mm:ss');
    const sql = `INSERT INTO manger_room (room_id,room,floor_id,room_num,room_dian,student_id,
        room_water
    ) VALUES
     (?,?,?,?,?,?,?);
    `;
    db(sql, [ roomId,room, floor_id,room_num,room_dian,student_id,room_water ], (err, data) => {
        if (data.affectedRows !== 0) {
            res.send({
                data,
                code: 200
            })
        } else {
            res.send({
                code: 400,
                content: err,
                message: '告诉他账户不存在'
            })
        }
    })
})
module.exports = router